local hx__jiuyuan_mou = fk.CreateSkill({
  name = "hx__jiuyuan_mou",
  tags = { Skill.Lord, Skill.Compulsory },
})

hx__jiuyuan_mou:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player.phase == Player.Start and
    player:hasSkill(hx__jiuyuan_mou.name) and player:getMark("@hx__zhiheng_mou_ye") < 2 and
    #table.filter(player.room.alive_players, function(p) return p.kingdom == "wu" and p ~= player end) > 0
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:addPlayerMark(player, "@hx__zhiheng_mou_ye", 1)
  end,
})

hx__jiuyuan_mou:addEffect(fk.PreHpRecover, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return
      target == player and
      player:hasSkill(hx__jiuyuan_mou.name) and
      data.card and
      data.card.trueName == "peach" and
      data.recoverBy and
      data.recoverBy.kingdom == "wu" and
      data.recoverBy ~= player
  end,
  on_use = function(self, event, target, player, data)
    data.num = data.num + 1
  end,
})

hx__jiuyuan_mou:addEffect(fk.CardUsing, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(hx__jiuyuan_mou.name) and target ~= player and target.kingdom == "wu" and data.card.trueName == "peach"
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, hx__jiuyuan_mou.name)
  end,
})

return hx__jiuyuan_mou
